/*
* @Author: suddev
* @Date:   2017-08-02 10:50:09
* @Last Modified by:   SUDDEV
* @Last Modified time: 2017-09-12 00:49:02
*/

'use strict';
var _user = {
    // 用户登陆
    login : function(userInfo,resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/login.do'),
            data    : userInfo,
            method  : 'POST',
            success : resolve,
            error   : reject
        })
    },
    //检查登陆权限
    checkAdmin : function(resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/check_admin.do'),
            method  : 'GET',
            success : resolve,
            error   : reject
        })
    },
    getUserInfo : function(resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/get_information.do'),
            method  : 'GET',
            success : resolve,
            error   : reject
        })
    },
    getAllUser : function(resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/get_all_user.do'),
            method  : 'GET',
            success : resolve,
            error   : reject
        })
    },
    search : function(userInfo,resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/search.do'),
            method  : 'GET',
            data    : userInfo,
            success : resolve,
            error   : reject
        })
    },
    addUser : function(userInfo,resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/add_user.do'),
            method  : 'POST',
            data    : userInfo,
            success : resolve,
            error   : reject
        })
    },
    changeInfo : function(userInfo,resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/change_info.do'),
            method  : 'POST',
            data    : userInfo,
            success : resolve,
            error   : reject
        })
    },
    deleteUser : function(userInfo,resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/delete_user.do'),
            method  : 'POST',
            data    : userInfo,
            success : resolve,
            error   : reject
        })
    },
    // 登出
    logout : function(resolve,reject){
        _tools.request({
            url     : _tools.getServerUrl('/user/logout.do'),
            method  : 'POST',
            success : resolve,
            error   : reject
        })
    },
};